/**
 * Copyright (c) Freelens Authors. All rights reserved.
 * Copyright (c) OpenLens Authors. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */

// Pods
$pod-status-running-color: var(--colorOk);
$pod-status-pending-color: var(--colorWarning);
$pod-status-restarted-color: var(--colorOk);
$pod-status-evicted-color: var(--colorError);
$pod-status-succeeded-color: var(--colorSuccess);
$pod-status-failed-color: var(--colorError);
$pod-status-terminated-color: var(--colorTerminated);
$pod-status-finalizing-color: var(--colorTerminated);
$pod-status-terminating-color: var(--colorTerminated);
$pod-status-unknown-color: var(--colorVague);
$pod-status-complete-color: var(--colorSuccess);
$pod-status-crash-loop-color: var(--colorError);
$pod-scheduled: var(--colorOk);
$pod-ready: var(--colorOk);
$pod-initialized: var(--colorOk);
$pod-unschedulable: var(--colorError);
$pod-containers-ready: var(--colorInfo);
$pod-error: var(--colorError);
$pod-container-creating: var(--colorInfo);
$pod-container-ephemeral: var(--colorInfo);

// Deployments
$deployment-available: var(--colorOk);
$deployment-progressing: var(--colorInfo);
$deployment-replicafailure: var(--colorError);

// Jobs
$job-complete: var(--colorSuccess);
$job-failed: var(--colorError);

// Cronjob
$cronjob-scheduled: var(--colorSuccess);
$cronjob-suspended: var(--colorTerminated);

// Pod Statuses
$pod-status-color-list: (
  running: $pod-status-running-color,
  pending: $pod-status-pending-color,
  restarted: $pod-status-restarted-color,
  evicted: $pod-status-evicted-color,
  waiting: $pod-status-pending-color,
  succeeded: $pod-status-succeeded-color,
  failed: $pod-status-failed-color,
  terminating: $pod-status-terminating-color,
  finalizing: $pod-status-finalizing-color,
  terminated: $pod-status-terminated-color,
  completed: $pod-status-complete-color,
  crash-loop-back-off: $pod-status-crash-loop-color,
  error: $pod-error,
  container-creating: $pod-container-creating,
  container-ephemeral: $pod-container-ephemeral,
);

// Job Conditions
$job-condition-color-list: (
  Complete: $job-complete,
  Failed: $job-failed,
);

// Cronjob Conditions
$cronjob-condition-color-list: (
  Scheduled: $cronjob-scheduled,
  Suspended: $cronjob-suspended,
);

@mixin pod-status-bgs {
  @each $status, $color in $pod-status-color-list {
    &.#{$status} {
      color: white;
      background: $color;
    }
  }
}

@mixin pod-status-colors {
  @each $status, $color in $pod-status-color-list {
    &.#{$status} {
      color: $color;
    }
  }
}

@mixin job-condition-bgs {
  @each $condition, $color in $job-condition-color-list {
    .#{$condition} {
      color: white;
      background: $color;
    }
  }
}

@mixin job-condition-colors {
  @each $condition, $color in $job-condition-color-list {
    &.#{$condition} {
      color: $color;
    }
  }
}
